package hunterxhunter.greedisland.data;

import hunterxhunter.greedisland.data.enums.AquisitionLevel;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Markus Schr&ouml;der
 */
public class CardManager {
    
    private static CardManager manager = new CardManager();
    
    private Map<Integer, Card> cards;
    
    private CardManager() {
        cards = new HashMap<Integer, Card>();
        createFixedCards();
        createSpellCards();
        createItemCards();
        createMonsterCards();
    }
    
    public static CardManager getInstance() {
        return manager;
    }
    
    public Card getCard(int number) {
        if(!cards.containsKey(number))
            return null;
        return cards.get(number);
    }
    
    private void createFixedCards() {
        putCard(new Card(79, "RAINBOW\nDIAMOND", AquisitionLevel.A, 20, "This diamond shines with seven\ncolors.There's a 100% chance of\ngetting a \"yes\" if you propose\nmarriage using this diamond."));
        putCard(new Card(83, "SWORD OF\nTRUTH", AquisitionLevel.B, 22, "Cuts right through all false things. Can\nalso be used to perform judgement."));//\nTouch the accused with the sword and\nif he is true, the sword will desintegrate\ninstead of cutting him. It will the regenerate\nin one day's time, if put back into the sheath."));
    }
    
    private void createSpellCards() {
        putCard(new Card(1001, "STEAL", AquisitionLevel.G, 200, "See all content of target player's free slots\n(limited to players previously met within the game)."));
        putCard(new Card(1002, "FLUROSCOPY", AquisitionLevel.F, 150, "See all content of target player's imposed slots pages\n(limited to players previously met within the game)."));
        putCard(new Card(1003, "DEFENSIVE\nWALL", AquisitionLevel.G, 400, "Protect once against spell attack from another player."));
        putCard(new Card(1004, "REFLECTION", AquisitionLevel.E, 120, "Reflect a spell attack from another player\n(limited to players previously met within the game)."));
        putCard(new Card(1005, "MAGNETIC\nFORCE", AquisitionLevel.C, 50, "Jump to the location of another player\n(limited to players previously met within the game)."));
        putCard(new Card(1006, "PICK\nPOCKET", AquisitionLevel.F, 170, "Steal one random card from free slots of another player."));
        putCard(new Card(1007, "THIEF", AquisitionLevel.C, 50, "Steal one random card from imposed slots of another player."));
        putCard(new Card(1008, "TRADE", AquisitionLevel.E, 100, "Exchange one card owned by caster with one opponent card at random."));
        putCard(new Card(1009, "RETURN", AquisitionLevel.G, 380, "Fly to determined city (limited to previously visited cities)."));
        putCard(new Card(1010, "TRANSFORM", AquisitionLevel.A, 20, "Transform one card owned by caster\ninto the type of another of his cards."));
        putCard(new Card(1011, "CLONE", AquisitionLevel.D, 70, "Change into one random card from target player's imposed slots\n(if the opponent has no imposed slots card or\nthe card limit was at MAX,\nthe transformation fails and CLONE disappears)."));
        putCard(new Card(1012, "RAILGUIDE", AquisitionLevel.F, 140, "Make target player fly somewhere on the island."));
        putCard(new Card(1013, "DEPARTURE", AquisitionLevel.D, 65, "Make target player fly to game starting point."));
        putCard(new Card(1014, "LEAP", AquisitionLevel.B, 30, "Make target player leave the island."));
        putCard(new Card(1015, "SIGHTVISION", AquisitionLevel.D, 70, "See all card data of target player."));
        putCard(new Card(1016, "DRIFT", AquisitionLevel.F, 200, "Go to all unvisited towns\n(if all towns have been visited, player stays at the\nsame place and the card disappears)."));
        putCard(new Card(1017, "COLUSION", AquisitionLevel.F, 200, "Fly to the locations of all players caster has not yet met\n(if all other players have been met,\nplayer stays at the same place and the card disappears)."));
        putCard(new Card(1018, "LEVY", AquisitionLevel.B, 25, "Take one random card from each player within a 20m radius."));
        putCard(new Card(1019, "CASTLE GATE", AquisitionLevel.F, 200, "Protect once against a short range regular spell from another player."));
        putCard(new Card(1020, "FAKE", AquisitionLevel.C, 40, "FAKE transforms into one of the cards from No.001 to No.099."));
        putCard(new Card(1021, "ROB", AquisitionLevel.B, 30, "Choose one card at will from target player and take it."));
        putCard(new Card(1022, "CORRUPTION", AquisitionLevel.C, 40, "Transforms one above-B ranked card from target player\ninto a below-D card. The caster can choose\nthe number of the new card.\nAfter the transformation, if the card is in an imposed slot\nwith a wrong number, it auto-destroys."));
        putCard(new Card(1023, "COMPROMISE", AquisitionLevel.B, 25, "Choose and destroy one above-A ranked card from target player."));//...TODO
        putCard(new Card(1024, "PENETRATE", AquisitionLevel.D, 80, "Return all cards from target player transformed with FAKE,\nCLONE or TRANSFORM to original form. Destroy all cards that,\nas a result, find themselves in the wrong imposed slots.\nFAKE, COPY and TRANSFORM have no effect on PENETRATE."));
        putCard(new Card(1025, "BLACKOUT\nCURTAIN", AquisitionLevel.F, 200, "Usage of this card protects one against the effects of STEAL\nand FLUROSCOPY (no accumulative benefits arise from using another BLACK CURTAIN card\nwhile former one is still in effect)."));
        putCard(new Card(1026, "HOLY WATER", AquisitionLevel.A, 20, "Usage of this card protects players 10 times against attack spells from\nother players. This card has immunity\nagainst steal or destruction spells."));
        putCard(new Card(1027, "TRACE", AquisitionLevel.E, 90, "Be continuously informed of target player's location\n(effect lasts until target player leaves the game)."));
        putCard(new Card(1028, "STONE\nTHROW", AquisitionLevel.E, 100, "Destroy one random card in target player's free slots."));
        putCard(new Card(1029, "SHOT", AquisitionLevel.B, 25, "Destroy one random card in target player's imposed slots."));
        putCard(new Card(1030, "GUIDEPOST", AquisitionLevel.E, 120, "Give away locations of items of the choosen number\n(not applicable to No.000)."));
        putCard(new Card(1031, "ANALYSIS", AquisitionLevel.G, 400, "Show explanation on card of the choosen number\n(not applicable to No.000)."));
        putCard(new Card(1032, "LOTTERY", AquisitionLevel.G, 350, "Transform into a random item card."));
        putCard(new Card(1033, "ADHESION", AquisitionLevel.C, 50, "Be continuously informed on imposed slots contents of\ntarget player (effect lasts until target player\nleaves the game)."));
        putCard(new Card(1034, "PURIFY", AquisitionLevel.D, 55, "Dispell effect of transformation spell and return card to original form."));
        putCard(new Card(1035, "PRISON", AquisitionLevel.S, 10, "Cards inserted in slots on target page are permanenty\nprotected against stealing and destruction spells as long\nas they remain in the slots."));
        putCard(new Card(1036, "GOD EYE", AquisitionLevel.S, 10, "Caster obtains the effects of ANALYSIS and LIST\nspells permanently on all cards from No.001 to No.009\n(effect lasts until target player leaves the game)."));
        putCard(new Card(1037, "RECYCLE", AquisitionLevel.F, 170, "Allows an item converted from a card to be changed into\ncard form once more. (Limited to cards of rank below C)."));
        putCard(new Card(1038, "LIST", AquisitionLevel.G, 350, "Inform on number of people in possession of target card,\nas well as the total number of copies."));
        putCard(new Card(1039, "ACCOMPANY", AquisitionLevel.F, 130, "Fly all players within a radius of 20m around the caster\n(including himself) to the location of target city (limited to\ncities previously visited) or target player\n(limited to players previously met inside the game)."));
        putCard(new Card(1040, "CONTACT", AquisitionLevel.F, 200, "Allows comunication through the binders with target player\n(limited to players previously met inside the game). Maximum duration is 3 minutes.\nDuring this period, only the player who initiated\nthe conversation with CONTACT can cut off communication)."));
    }
    
    private void createItemCards() {
        putCard(new Card(21449, "STONE", AquisitionLevel.H, -1, "Can be found on the roadside.\nExtremely common. If you throw\nit at a person, it can cause\nsome small damage."));
    }
    
    private void createMonsterCards() {
        
    }
    
    private void putCard(Card card) {
        cards.put(card.getNumber(), card);
    }
          
}
